#!/usr/bin/env python
#coding:utf-8
import cyclone.auth
import cyclone.escape
import cyclone.web
from beaker.cache import cache_managers
from toughadmin.console.admin.base import BaseHandler
from toughadmin.tools.permit import permit
from toughadmin.console.admin import (
    radius, portal, api, dashboard, logger, backup, bas, domain, ssid, config,
    template, userPackets, password, ostype, policy_server, gwid, operator,
    login,logout,ikuai,api_ikuai,api_session,session
)

class HomeHandler(BaseHandler):
    @cyclone.web.authenticated
    def get(self):
        self.render("index.html")


class CacheCleanHandler(BaseHandler):
    @cyclone.web.authenticated
    def get(self):
        for _cache in cache_managers.values():
            _cache.clear()
        return self.render_json(code=0, msg=u"已刷新缓存")


permit.add_handler(HomeHandler, r"/")
permit.add_handler(CacheCleanHandler, r"/cache/clean")

